package com.wtx.security.util;

import org.springframework.security.core.authority.SimpleGrantedAuthority;

import java.util.HashSet;
import java.util.List;
import java.util.Set;

public class PermissionUtil {

    public static Set<SimpleGrantedAuthority> getAuthorities(List<String> permissionList){
        Set<SimpleGrantedAuthority> authorities = new HashSet<>();
        for(String permission: permissionList){
            authorities.add(new SimpleGrantedAuthority(permission.trim()));
        }
        return authorities;
    }
}
